//
//  SpecialListenCollectionViewCell.m
//  SuperNews
//
//  Created by dllo on 16/1/13.
//  Copyright © 2016年 qiang. All rights reserved.
//

#import "SpecialListenCollectionViewCell.h"

#define WIDTH self.contentView.bounds.size.width
#define HEIGHT self.contentView.bounds.size.height

@implementation SpecialListenCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    self.backgroundColor = [UIColor whiteColor];
    self.imageV = [[UIImageView alloc] init];
    self.imageV.layer.cornerRadius = (self.contentView.bounds.size.width - 20) / 2.0;
    self.imageV.layer.masksToBounds = YES;
    self.userInteractionEnabled = YES;
    self.imageV.backgroundColor = [UIColor greenColor];
    [self.contentView addSubview:self.imageV];
    
    self.playButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.playButton setImage:[UIImage imageNamed:@"audionews_index_play"] forState:UIControlStateNormal];
    [self.imageV addSubview:self.playButton];
    
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.font = [UIFont systemFontOfSize:12.0];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.titleLabel];
    
    self.detailLabel = [[UILabel alloc] init];
    self.detailLabel.textColor = [UIColor colorWithRed:0.4609 green:0.4609 blue:0.4609 alpha:1.0];
    self.detailLabel.numberOfLines = 0;
    self.detailLabel.font = [UIFont systemFontOfSize:10.0];
    [self.contentView addSubview:self.detailLabel];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.imageV.frame = CGRectMake(10, 10, WIDTH - 20, WIDTH - 20);
    self.playButton.frame = CGRectMake((WIDTH - 60) / 2.0, (WIDTH - 60) / 2.0, 40, 40);
    self.titleLabel.frame = CGRectMake(10, WIDTH, WIDTH - 20, (HEIGHT - WIDTH - 5) / 3.0);
    self.detailLabel.frame = CGRectMake(10, WIDTH + (HEIGHT - WIDTH - 5) / 3.0, WIDTH - 20, (HEIGHT - WIDTH - 5) / 3.0 * 2.0);
}

@end
